package EffectiveJava.chapter2;

import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author zhangersi
 * @Description
 * @date 2022年09月05日 20:11
 */
public class tryWithResources {

    public String test(String[] args) throws IOException {
        try(BufferedReader br = new BufferedReader(new FileReader("fa"))){
            return br.readLine();
        }
    }

    public void test2() throws IOException {
        try(InputStream in = new FileInputStream("s");
            OutputStream out = new FileOutputStream("s")){
            byte[] buf = new byte[100];
            int n;
            while((n = in.read(buf)) >= 0){
                out.write(buf, 0, n);
            }
        }
    }

    public static void main(String[] args) {
        List<Long> list = Collections.emptyList();
        List<Long> objects = new ArrayList<>(list);
        System.out.println(objects);
    }
}
